<!DOCTYPE html>
<html lang="en"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>作品管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="icon" href="../../../static/images/favicon.ico" th:href="@{/images/favicon.ico}">
    <link rel="stylesheet" href="../../../static/plugin/layui/css/layui.css" th:href="@{/plugin/layui/css/layui.css}"
          media="all"/>
    <link rel="stylesheet" href="../../../static/back_css/public.css" th:href="@{/back_css/public.css}" media="all"/>
    <link rel="stylesheet" href="../../../static/back_css/work_management.css"
          th:href="@{/back_css/work_management.css}" media="all">

</head>
<body>
<div id="main">
    <div class="container">
        <div class="container_top">
            <ul>
                <li>
                    <input type="text" name="WORK_NAME" placeholder="请输入关键字" class="searchVal">
                </li>
                <li th:if="${isSup}==0 and ${flag}==false">
                    <div class="layui-input-inline">
                        <select name="AUDIT_STATE" id="AUDIT_STATE" lay-verify="required">
                            <option value="">请选择作品状态</option>
                            <option value="1">已通过</option>
                            <option value="0">待审核</option>
                            <option value="2">未通过</option>
                            <option value="3">已提交</option>
                        </select>
                    </div>
                </li>

                <li th:if="${isSup}==1">
                    <div class="layui-input-inline">
                        <select name="DISTRICT_ID" id="DISTRICT_ID" lay-verify="required">
                            <option value="">请选择所属地区</option>
                            <option th:each="districtLists:${districtLists}" th:value="${districtLists.ID}"><span
                                    th:text="${districtLists.DISTRICT_NAME}"></span></option>
                        </select>
                    </div>
                </li>
                <li>
                    <button style="width: 45px;height: 25px;" class="search_btn">查询
                    </button>
                </li>
                <li th:if="${flag}==true or ${isSup}==1">
                    <button style="width: 90px;height: 25px;" class="GoPrize">设置奖项</button>
                </li>
                <li class="container_content">
                    <button class="layui-btn" id="msg" style="width: 120px;height: 27px;line-height: 27px;">
                        <i class="iconfont icon-export" style="font-weight: initial "></i> 设置获奖通知
                    </button>
                </li>
            </ul>
        </div>
        <div class="container_content">
            <form class="layui-form">
                <table id="worksList" lay-even class="layui-table" lay-filter="worksList" lay-skin="nob"></table>

                <!--审核状态-->
                <script type="text/html" id="worksStatus">
                    {{#  if(d.audit_STATE == "0"){                   }}
                    <span class="layui-yellow">待审核</span>
                    {{#  } else if(d.audit_STATE=="1"){              }}
                    <span class="layui-green">已通过</span>
                    {{#  }else{                                      }}
                    <span class="layui-red">未通过</span>

                    {{#  }                                           }}

                </script>

                <!--操作-->
                <script type="text/html" id="controls">



                    <a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="detail">详情</a>
                    {{#   if(d.is_AWARD==0){                  }}
                    <a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="verify">领奖</a>
                    {{#   }else{                                    }}
                    <a class="layui-btn layui-btn-xs layui-btn-warn" lay-event="verifys">已领奖</a>
                    {{#         }                                  }}
                    </span>
                </script>
                <input type="hidden" value="0" id="in">
            </form>
        </div>
    </div>
</div>

<div class="edit_id" style="display: none;">
    <form class="layui-form" action="" method="get">
        <div>
            <span>编辑账号</span>
            <button id="close" type="button"><i class="layui-icon">&#x1006;</i></button>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">用户名：</label>
            <div class="layui-input-block">
                <input type="text" id="edit_username" readonly name="ADMIN_ACCOUNT" lay-verify="required" autocomplete="off" placeholder="请输入用户名"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">密码：</label>
            <div class="layui-input-block">
                <input type="password" name="ADMIN_PASSWORD" lay-verify="required|newPwd" autocomplete="off" placeholder="请输入密码"
                       class="layui-input" id="password">
                <img src="/img/see.png" onclick="showhide()" id="eye" title="查看密码">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">确认密码：</label>
            <div class="layui-input-block">
                <input type="password" name="password2" lay-verify="required|confirmPwd" autocomplete="off"
                       placeholder="请确认密码" class="layui-input" id="password2">
                <span id="password2_tips"></span>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">用户名：</label>
            <div class="layui-input-block">
                <input type="text" id="edit_adminname" name="ADMIN_NAME" lay-verify="required" autocomplete="off" placeholder="请输入用户名"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">推荐单位：</label>
            <div class="layui-input-block">
                <div class="layui-input-inline">
                    <select id="edit_district" name="DISTRICT_ID" lay-verify="required">
                        <option value="">推荐单位</option>
                        <option id="select" th:each="districtLists:${districtLists}" th:value="${districtLists.ID}"><span th:text="${districtLists.DISTRICT_NAME}"></span></option>
                    </select>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">联系电话：</label>
            <div class="layui-input-block">
                <input type="text" id="edit_mobile" name="PHONE" lay-verify="phone|phonesub" maxlength="11" autocomplete="off"
                       placeholder="请输入电话号码" class="layui-input">
            </div>
        </div>
        <input type="hidden" name="action" id="form_action">
        <div class="layui-form-item_btn">
            <button type="button" class="layui-btn " id="cancel">取消</button>
            <button lay-submit class="layui-btn" id="sure" lay-filter="formDemo">确定</button>
        </div>
        <input type="hidden" id="dis" th:value="${ads}"/>
        <input type="hidden" id="isSup" th:value="${isSup}"/> <!-- 是否是超级管理员-->
        <input type="hidden" id="level" th:value="${level}"/> <!-- 管理员等级-->
        <input type="hidden" id="is_ADMIN">
    </form>
</div>
<script type="text/html" id="prize">
    <div class="works_vet" id="prize_list">
        <form class="layui-form" action="" method="get" style="width:400px;">
            <input type="hidden" name="work_ID" value="[work_ID]">
            <div>
                <span>设置奖项</span>
                <button class="close" type="button"><i class="layui-icon">&#x1006;</i></button>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block select_parent" style="margin:0;">
                    <select name="PRIZE_ID" id="PRIZE_ID" lay-verify="required">
                        <option value="">请选择奖项</option>
                        <option th:each="pri:${prize}" th:value="${pri.PRIZE_ID}"><span
                                th:text="${pri.PRIZE_NAME}"></span></option>
                    </select>
                </div>
            </div>

            <div class="layui-form-item" style="margin-top:30px;text-align:center;">
                    <button type="button" class="layui-btn layui-btn-warm layui-btn-radius cancel">取消</button>
                    <button type="button" class="layui-btn layui-btn-warm layui-btn-radius sure">确定</button>
            </div>
        </form>
    </div>
</script>
<script type="text/html" id="video_verify">
    <div class="works_vet">
        <form class="layui-form" action="" method="get">
            <input type="hidden" name="work_ID" value="[work_ID]">
            <div>
                <span>审核视频</span>
                <button class="close" type="button"><i class="layui-icon">&#x1006;</i></button>
            </div>
            <div class="layui-form-item">
                <h3>[work_NAME]</h3>
                <ul>
                    <li>
                        <i class="layui-icon layui-icon-username"></i>
                        <span>[user_NAME]</span>
                    </li>
                    <li>
                        <i class="layui-icon layui-icon-date"></i>
                        <span>[WORK_UPTIME]</span>
                    </li>
                    <li style="visibility: hidden;"><img src="../../images/heard.png">
                        <span>0</span>
                    </li>
                    <li>
                        <button type="button" class="layui-btn layui-btn-warm layui-btn-xs"
                                onclick="download('[work_ID]');"><img src="../../images/download.png">下载
                        </button>
                    </li>
                    <div class="clear"></div>
                </ul>
                <div class="layui-form-video">
                    <video width="710" height="350" src="[resource_URL]" controls="controls">
                    </video>
                </div>
                <ul>
                    <li><span>推荐单位：</span>
                        <span>[district_NAME]</span>
                    </li>
                    <br/>
                    <li><span>作品描述：</span>
                        <span>[work_ASSESSMENT]</span>
                    </li>
                    <div class="clear"></div>
                </ul>
                <div class="layui-form-vet layui-form_video">
                    <span>审核是否通过：</span>
                    <input type="radio" name="result" checked lay-filter="verify_radio"
                           class="layui-btn layui-btn-warm layui-btn-xs" value="1"
                           title="通过"/>
                    <input type="radio" name="result" lay-filter="verify_radio"
                           class="layui-btn layui-btn-warm layui-btn-xs" value="2"
                           title="拒绝"/>
                    <textarea placeholder="请输入内容" name="comment" class="layui-textarea"
                              style="height: 150px;display: none"></textarea>
                </div>
                <div class="layui-form-close close_video">
                    <button type="button" class="layui-btn layui-btn-warm layui-btn-radius cancel">取消</button>
                    <button type="button" class="layui-btn layui-btn-warm layui-btn-radius sure">确定</button>
                </div>
            </div>

        </form>
    </div>
</script>
<script type="text/html" id="audio_verify">
    <div class="works_vet">
        <form class="layui-form" action="" method="get">
            <input type="hidden" name="work_ID" value="[work_ID]">
            <div>
                <span>审核音频</span>
                <button class="close" type="button"><i class="layui-icon">&#x1006;</i></button>
            </div>
            <div class="layui-form-item ">
                <div>
                    <div class="vet_audio_img">
                        <img src="[work_IMGURL]">
                    </div>
                    <div class="vet_audio">
                        <h5>[work_NAME]</h5>
                        <ul>
                            <li>
                                <i class="layui-icon layui-icon-username"></i>
                                <span>[user_NAME]</span>
                            </li>
                            <li>
                                <i class="layui-icon layui-icon-date"></i>
                                <span>[WORK_UPTIME]</span>
                            </li>
                            <li style="visibility: hidden;"><img src="../../images/heard.png">
                                <span>0</span>
                            </li>
                            <div class="clear"></div>
                        </ul>
                        <div style="line-height: 35px;">

                            <audio controls="controls" src="[resource_URL]" style="width:100%;height:32px;">

                            </audio>
                        </div>
                    </div>
                    <div class="vet_works_down">
                        <div>
                            <button type="button" class="layui-btn layui-btn-warm layui-btn-xs down_btn"
                                    onclick="download('[work_ID]');"><img src="../../images/download.png">下载
                            </button>
                        </div>
                    </div>
                </div>
                <ul class="address_ul">
                    <li><span>推荐单位：</span>
                        <span>[district_NAME]</span>
                    </li>
                    <br/>
                    <li><span>作品描述：</span>
                        <span>[work_ASSESSMENT]</span>
                    </li>
                    <div class="clear"></div>
                </ul>
                <div class="layui-form-vet " id="vet_works_text">
                    <span>审核是否通过：</span>
                    <input type="radio" name="result" checked lay-filter="verify_radio"
                           class="layui-btn layui-btn-warm layui-btn-xs" value="1"
                           title="通过"/>
                    <input type="radio" name="result" lay-filter="verify_radio"
                           class="layui-btn layui-btn-warm layui-btn-xs" value="2"
                           title="拒绝"/>
                    <textarea placeholder="请输入内容" name="comment" class="layui-textarea"
                              style="height: 150px;display: none"></textarea>
                </div>
                <div class="layui-form-close">
                    <button type="button" class="layui-btn layui-btn-warm layui-btn-radius cancel">取消</button>
                    <button type="button" class="layui-btn layui-btn-warm layui-btn-radius sure">确定</button>
                </div>
            </div>

        </form>
    </div>
</script>
<script type="text/html" id="video_details_view">
    <div class="works_vet">
        <form class="layui-form" action="" method="get">
            <div>
                <span>视频详情</span>
                <button class="close" type="button"><i class="layui-icon">&#x1006;</i></button>
            </div>
            <div class="layui-form-item">
                <h3>[work_NAME]</h3>
                <ul>
                    <li>
                        <i class="layui-icon layui-icon-username"></i>
                        <span>[user_NAME]</span>
                    </li>
                    <li>
                        <i class="layui-icon layui-icon-date"></i>
                        <span>[WORK_UPTIME]</span>
                    </li>
                    <li style="visibility: hidden;"><img src="../../images/heard.png">
                        <span>0</span>
                    </li>
                    <li>
                        <button type="button" class="layui-btn layui-btn-warm layui-btn-xs"
                                onclick="download('[work_ID]');"><img src="../../images/download.png">下载
                        </button>
                    </li>
                    <div class="clear"></div>
                </ul>
                <div class="layui-form-video">
                    <video width="710" height="350" src="[resource_URL]" controls="controls">
                    </video>
                </div>
                <ul>
                    <li><span>推荐单位：</span>
                        <span>[district_NAME]</span>
                    </li>
                    <br/>
                    <li><span>作品描述：</span>
                        <span>[work_ASSESSMENT]</span>
                    </li>
                    <div class="clear"></div>
                </ul>
            </div>

        </form>
    </div>
</script>
<script type="text/html" id="audio_details_view">
    <div class="works_vet">
        <form class="layui-form" action="" method="get">
            <div>
                <span>音频详情</span>
                <button class="close" type="button"><i class="layui-icon">&#x1006;</i></button>
            </div>
            <div class="layui-form-item ">
                <div>
                    <div class="vet_audio_img">
                        <img src="[work_IMGURL]">
                    </div>
                    <div class="vet_audio">
                        <h5>[work_NAME]</h5>
                        <ul>
                            <li>
                                <i class="layui-icon layui-icon-username"></i>
                                <span>[user_NAME]</span>
                            </li>
                            <li>
                                <i class="layui-icon layui-icon-date"></i>
                                <span>[WORK_UPTIME]</span>
                            </li>
                            <li style="visibility: hidden;"><img src="../../images/heard.png">
                                <span>0</span>
                            </li>
                            <div class="clear"></div>
                        </ul>
                        <div style="line-height: 35px;">

                            <audio controls="controls" src="[resource_URL]" style="width:100%;height:32px;">

                            </audio>
                        </div>
                    </div>
                    <div class="vet_works_down">
                        <div>
                            <button type="button" class="layui-btn layui-btn-warm layui-btn-xs down_btn"
                                    onclick="download('[work_ID]');"><img src="../../images/download.png">下载
                            </button>
                        </div>
                    </div>
                </div>
                <ul class="address_ul">
                    <li><span>推荐单位：</span>
                        <span>[district_NAME]</span>
                    </li>
                    <br/>
                    <li><span>作品描述：</span>
                        <span>[work_ASSESSMENT]</span>
                    </li>
                    <div class="clear"></div>
                </ul>
            </div>

        </form>
    </div>
</script>
<script type="text/html" id="pic_details_view">
    <div class="works_vet">
        <form class="layui-form" action="" method="get">
            <div>
                <span>图片详情</span>
                <button class="close" type="button"><i class="layui-icon">&#x1006;</i></button>
            </div>
            <div class="layui-form-item ">
                <div>
                    <div class="vet_audio_img">
                        <img src="[work_IMGURL]">
                    </div>
                    <div class="vet_audio">
                        <h5>[work_NAME]</h5>
                        <ul>
                            <li>
                                <i class="layui-icon layui-icon-username"></i>
                                <span>[user_NAME]</span>
                            </li>
                            <li>
                                <i class="layui-icon layui-icon-date"></i>
                                <span>[WORK_UPTIME]</span>
                            </li>
                            <li style="visibility: hidden;"><img src="../../images/heard.png">
                                <span>0</span>
                            </li>
                            <div class="clear"></div>
                        </ul>
                    </div>
                    <input type="hidden" name="resource_URL" value="[resource_URL]">
                    <div class="vet_works_down">
                        <button type="button" class="layui-btn layui-btn-warm layui-btn-radius autio">查看图片</button>
                    </div>
                </div>
                <ul class="address_ul">
                    <li><span>推荐单位：</span>
                        <span>[district_NAME]</span>
                    </li>
                    <br/>
                    <li><span>作品描述：</span>
                        <span>[work_ASSESSMENT]</span>
                    </li>
                    <div class="clear"></div>
                </ul>
            </div>
        </form>
    </div>
</script>
<script type="text/html"  id="pic_details_views">
    <div class="works_vet">
        <form class="layui-form" action="" method="get">
            <div>
                <span>图片详情</span>
                <button class="close" type="button"><i class="layui-icon">&#x1006;</i></button>
            </div>
            <div class="layui-form-item" id="pics">
                [html]
            </div>
        </form>
    </div>
</script>
<script type="text/javascript" src="../../../static/plugin/layui/layui.js" th:src="@{/plugin/layui/layui.js}"></script>
<script type="text/javascript">
    window.tplReg = new RegExp("\\[([^\\[\\]]*?)\\]", 'igm'); //i g m是指分别用于指定区分大小写的匹配、全局匹配和多行匹配。

    layui.use(['form', 'layer', 'laydate', 'table', 'laytpl', 'slider'], function () {
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery,
            laydate = layui.laydate,
            laytpl = layui.laytpl,
            slider = layui.slider,
            table = layui.table;
        $.fn.serializeObject = function () {
            var o = {};
            var a = this.serializeArray();
            $.each(a, function () {
                if (o[this.name]) {
                    if (!o[this.name].push) {
                        o[this.name] = [o[this.name]];
                    }
                    o[this.name].push(this.value || '');
                } else {
                    o[this.name] = this.value || '';
                }
            });
            return o;
        }
        //console.log("-----------------------------------------------------------------------------");
        table_render('/getWorkByActivityIdsss');

        //作品列表
        function table_render(url) {
            var ins1 = table.render({
                elem: '#worksList',
                url: url,
                cellMinWidth: 95,
                page: true,
                height: "",
                even: true, //开启隔行背景
                limit: 10,
                limits: [10, 15, 20, 25, 30, 35, 40, 45, 50],
                id: "worksListTable",
                cols: [
                    [
                        {type: "checkbox", fixed: "left", hide: true, width: 45},
                        {field: 'work_ID', unresize: true, title: '编号', width: 80},
                        {field: 'resource_URL', title: '下载地址', hide: true},
                        {
                            field: 'work_IMGURL',
                            unresize: true,
                            title: '作品封面',
                            width: 100,
                            templet: function (d) {
                                return '<div><img src="' + d.work_IMGURL + '"></div>';
                            }
                        },
                        {field: 'work_NAME', unresize: true, title: '作品名称', width: 95},
                        {
                            field: 'work_TYPE',
                            title: '作品类型',
                            unresize: true,
                            align: 'center',
                            // sort: true,
                            minWidth: 95,
                            templet: function (d) {
                                if (d.work_TYPE == "0") {
                                    return "视频";
                                } else if (d.work_TYPE == "1") {
                                    return "音频";
                                } else if (d.work_TYPE == "2") {
                                    return "图片";
                                }
                            }

                        },
                        {
                            field: 'audit_STATE',
                            unresize: true,
                            title: '作品状态',
                            width: 95,
                            align: 'center',
                            templet: "#worksStatus"
                        },
                        {field: 'user_NAME', unresize: true, title: '作者', width: 95, align: 'center'},
                        {field: 'votes_NUMBER', unresize: true, title: '获得票数', width: 105, align: 'center', sort: true},
                        {field: 'district_NAME', unresize: true, title: '推荐单位', width: 150, align: 'center'},
                        {field: 'prize_NAME', unresize: true, title: '奖项信息', width: 100, align: 'center'},
                        {field: 'company', title: '所在单位', unresize: true, width: 170, align: 'center', hide: true},
                        {
                            field: 'work_UPTIME',
                            unresize: true,
                            title: '上传时间',
                            align: 'center',
                            sort: true,
                            minWidth: 140,
                            templet: function (d) {
                                //console.log(d)
                                return d.work_UPTIME.substring(0, 11);
                            }
                        },
                        {title: '操作', unresize: true, width: 340, templet: '#controls', fixed: "right", align: "center"}
                    ]
                ],
                parseData: function (res) { //res 即为原始返回的数据
                    var a = res.IS_LOCAL;
                    $("#in").val(a);
                    exportData = res.data
                }
            });
            $("#export").click(function () {
                ins1.config.title = '作品信息统计表';
                table.exportFile(ins1.config.id, exportData, 'xls');
            })
            $("#export1").click(function () {
                window.location.href = '/export?id=3';
            })

        }

        $("body").on("click", "div.works_vet button.autio", function (e) {
            debugger
            var obj = $(this).parents("form").serializeObject();
            var strArr= obj.resource_URL.split(",");
            var source = $("#pic_details_views").html().replace(tplReg, function (node, key) {
                var htmls="";
                for(var i = 0; i<strArr.length-1;i++){
                    var html='<a href="'+ strArr[i] +'" target="_blank"><img src="' + strArr[i] + '" style="width: 33.3%;height: 150px"/><a/>';
                    htmls =htmls+html;
                }
                return htmls;
            });
            $(document.body).append(source);
            return false;
        })
        $("#msg").on("click", function () {
            window.location.href='/prizeMsg';
        });
        //搜索【此功能需要后台配合，所以暂时没有动态效果演示】
        $(".search_btn").on("click", function () {
            // console.log(
            //     'WORK_NAME:'+   $(".searchVal").val(),
            //     'DISTRICT_ID:'+ $("#DISTRICT_ID").val(),
            //     'AUDIT_STATE:'+ $("#AUDIT_STATE").val(),
            //     'IS_LOCAL: '+   $("#IS_LOCAL").val()
            // );
            table.reload("worksListTable", {
                page: {
                    curr: 1 //重新从第 1 页开始
                },
                where: {
                    WORK_NAME: $(".searchVal").val(),//搜索的关键字
                    DISTRICT_ID: $("#DISTRICT_ID").val(),//地址ID
                    AUDIT_STATE: $("#AUDIT_STATE").val(),
                    IS_LOCAL: $("#IS_LOCAL").val()
                }
            })
            return false;
        });
        $(".GoLocal").on("click", function () {
            window.location.href = '/works';

            return false;
        });
        $(".GoPrize").on("click", function () {
            window.location.href ='/work2';
            return false;
        });
        //批量删除
        $(".delAll_btn").click(function () {
            var checkStatus = table.checkStatus('worksListTable'),
                data = checkStatus.data,
                worksImage = [];
            if (data.length > 0) {
                for (var i in data) {
                    newsId.push(data[i].worksImage);
                }
                layer.confirm('确定删除选中的文章？', {icon: 3, title: '提示信息'}, function (index) {
                    // $.get("删除文章接口",{
                    //     newsId : newsId  //将需要删除的newsId作为参数传入
                    // },function(data){
                    tableIns.reload();
                    layer.close(index);
                    // })
                })
            } else {
                layer.msg("请选择需要删除的文章");
            }
        })
        $("body").on("click", "div.works_vet button.close", function (e) {
            $(this).parents("div.works_vet").remove();
            return false;
        })
        $("body").on("click", "div.works_vet button.cancel", function (e) {
            $(this).parents("div.works_vet").remove();
            return false;
        })
        $("body").on("click", "div.works_vet button.sure", function (e) {
            var obj = $(this).parents("form").serializeObject();
            if(obj.PRIZE_ID=="" || obj.PRIZE_ID==null){
                return layer.msg("请选择奖项！");
            }
            var that = this;
            $.ajax({//进行审核提交
                url: '/setPrize',
                async: false,
                type: "POST",
                data: {
                    WORK_ID: obj.work_ID,
                    PRIZE_ID:obj.PRIZE_ID
                },
                success: function (data) {
                    if(data==1){
                        layer.msg("设置成功！")
                    }else if(data==2){
                        layer.msg("该奖项没有剩余名额！")
                    }
                    //刪除彈窗
                    $(that).parents("div.works_vet").remove();
                    $(".layui-laypage-btn").click();
                    // table_render('/getWorkByActivityIdsss');
                }
            })

            return false;
        })
        //列表操作
        table.on('tool(worksList)', function (obj) {
            //.log("obj", obj)
            var layEvent = obj.event,
                data = obj.data;

            if (layEvent === 'verify') { //编辑
                layer.confirm('确定领奖？', {icon: 3, title: '提示信息'}, function (index) {
                    layer.close(index);
                    $.ajax({
                        url: '/award',
                        async: false,
                        type: "POST",
                        data: {WORK_ID: data.work_ID},
                        success: function (data) {
                            // console.log(data)
                            if (data == 1) {
                                layer.msg("设置成功！")
                                $(".layui-laypage-btn").click();
                                // table_render('/getWorkByActivityIdsss');
                            } else {//已有该用户名
                                layer.msg("正在加载···")
                                $(".layui-laypage-btn").click();
                                // table_render('/getWorkByActivityIdsss');
                            }
                        }
                    })
                });
            } else if (layEvent === 'verifys') {
                layer.msg("该奖品已被领取!");
            }else if (layEvent === "detail" && data.work_TYPE == 0) {
                //$("#video_details").css_bak("display", "block");
                var source = $("#video_details_view").html().replace(tplReg, function (node, key) {
                    return obj.data[key];
                });
                $(document.body).append(source);
                form.render("radio");

            } else if (layEvent === "detail" && data.work_TYPE == 1) { //编辑
                var source = $("#audio_details_view").html().replace(tplReg, function (node, key) {
                    return obj.data[key];
                });
                $(document.body).append(source);
                form.render("radio");

            } else if (layEvent === "detail" && data.work_TYPE == 2) { //编辑
                var source = $("#pic_details_view").html().replace(tplReg, function (node, key) {
                    return obj.data[key];
                });
                $(document.body).append(source);
                form.render("radio");

            }
        });
        // $("#vet").on("click",function () {
        //     $("#video").css_bak("display","block");
        // });
        $(".cancel1").on("click", function () {
            $("#audio").css("display", "none");
        });
        $(".close1").on("click", function () {
            $("#audio").css("display", "none");
        });
        $(".close2").on("click", function () {
            $("#video_details").css("display", "none");
        });
        $(".close3").on("click", function () {
            $("#audio_details").css("display", "none");
        });

        $(".layui-form-vet .layui-unselect:nth-child(5)").on("click", function () {
            $(".layui-textarea").css("display", "block");
        })
        $(".layui-form-vet .layui-unselect:nth-child(3)").on("click", function () {
            $(".layui-textarea").css("display", "none");
        });
        form.on("radio(verify_radio)", function (obj) {
            //console.log(obj)
            if (obj.value == "2") {

                obj.othis.siblings("textarea").css("display", "block");

            } else {

                obj.othis.siblings("textarea").css("display", "none");

            }

        });

    });

    function download(id) {
        window.location.href = '/download?work_ID=' + id;
    };
</script>
</body>
</html>